//
//  SearchCollectionViewCell.m
//  TextApplication
//
//  Created by dllo on 16/9/19.
//  Copyright © 2016年 yh. All rights reserved.
//

#import "SearchCollectionViewCell.h"
#import "TAMacro.h"
#import "MasterItems.h"
#import "MasterImage.h"
#import "UIImageView+WebCache.h"

@interface SearchCollectionViewCell ()
@property (nonatomic, strong) UIImageView *picImageView;
@property (nonatomic, strong) UILabel *nameLabel;
@end


@implementation SearchCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        _picImageView = [[UIImageView alloc] init];
        _nameLabel = [[UILabel alloc] init];
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    _picImageView.frame = CGRectMake(0, 0, CONTENTWIDTH, CONTENTWIDTH);
    _picImageView.backgroundColor = [UIColor grayColor];
    [self.contentView addSubview:self.picImageView];
    
    _nameLabel.frame = CGRectMake(0, CONTENTWIDTH + 5, CONTENTWIDTH, 20);
    _nameLabel.font = [UIFont systemFontOfSize:12];
    _nameLabel.textColor = [UIColor grayColor];
    [self.contentView addSubview:self.nameLabel];

}

- (void)setItem:(MasterItems *)item {
    _item = item;
    [_picImageView sd_setImageWithURL:[NSURL URLWithString:_item.user_images.orig]];
    _nameLabel.text = _item.nickname;
}

@end
